package mvc.model {
	import flash.utils.Dictionary;

	import mvc.model.vo.ViewVO;
	import mvc.view.StartupLoadingMediator;
	import mvc.view.components.StartupLoadingSprite;

	import org.puremvc.as3.patterns.proxy.Proxy;

	public class ViewProxy extends Proxy {
		public static const NAME:String = "ViewProxy";

		private var _allViews:Dictionary = new Dictionary();

		public function ViewProxy() {
			super(NAME);
		}

		public override function onRegister():void {
			registerView(StartupLoadingMediator.NAME, StartupLoadingMediator, StartupLoadingSprite,
				ViewVO.GAMEPLAY_LAYER, "loader.swf");
		}

		private function registerView(name:String, mediator:Class, viewComponent:Class, layer:int,
			file:String, className:String = null):void {
			var vo:ViewVO = new ViewVO();
			vo.name = name;
			vo.viewComponent = viewComponent;
			vo.mediator = mediator;
			vo.layerIndex = layer;
			vo.swfPath = file;
			vo.assetClassName = className;

			_allViews[name] = vo;
		}

		public function getViewVO(name:String):ViewVO {
			return _allViews[name];
		}
	}
}
